package xyz.lilei23.framework.transaction;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * @author lilei
 * @date 31/07/2021 16:20
 * @version 1.0
 **/
public interface TransactionManager {
    /**
     * 获取当前线程连接
     * @return
     * @throws SQLException
     */
    Connection getCurrentThreadConn() throws SQLException;

    /**
     * 开启事务
     * @return
     * @throws SQLException
     */
    void beginTransaction() throws SQLException;

    /**
     * 提交
     * @return
     * @throws SQLException
     */
    void commit() throws SQLException;

    /**
     * 回滚
     * @throws SQLException
     */
    void rollback() throws SQLException;
}
